﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;
using System.Web.Security;

namespace BF.Web
{
    public partial class Login_New : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnLogin_Click(object sender, DirectEventArgs e)
        {
            string username = this.txtUsername.Text.Trim();
            string password = this.txtPassword.Text.Trim();
            if (System.Web.Security.Membership.ValidateUser(username, password))
            {
                FormsAuthentication.SetAuthCookie(username, true);
                Response.Redirect(FormsAuthentication.DefaultUrl);
            }
            else
            {
                Ext.Net.Notification.Show(new Ext.Net.NotificationConfig
                {
                    Title = "系统提示",
                    Html = "<span style='color:red'>账号或密码错误！</span>",
                    Icon = Ext.Net.Icon.Information,
                    AlignCfg = new NotificationAlignConfig
                    {
                        ElementAnchor = AnchorPoint.BottomRight,
                        TargetAnchor = AnchorPoint.BottomRight,
                    },
                    AutoHide = true,
                    Height = 80,
                });
            }
        }
    }
}